package autoz.czt.uml;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.emf.common.util.EList;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Property;

import org.eclipse.uml2.uml.Class;
public class UmlClass{
		String name;
		List<String> attributes;
		List<String> operations;
		
		public UmlClass(Class c){
			this(c.getName(), c.getAllAttributes(), c.getAllOperations());
		}
		
		public UmlClass(String name, EList<Property> attributes, EList<Operation> operations){
			this.name = name;
			this.attributes = propertyListToStringList(attributes);
			this.operations = operationListToStringList(operations);
		}
		
		private List<String> propertyListToStringList(EList<Property> attributes){
			List<String> l = new ArrayList<String>();
			for (Property p : attributes){
				l.add(p.getName());
			}
			return l;
		}
		private List<String> operationListToStringList(EList<Operation> attributes){
			List<String> l = new ArrayList<String>();
			for (Operation p : attributes){
				l.add(p.getName());
			}
			return l;
		}

		public String getName() {
			return name;
		}

		public List<String> getAttributes() {
			return attributes;
		}

		public List<String> getOperations() {
			return operations;
		}
	}